import java.lang.*;
public class Clone1 implements Cloneable {
/** Clone este obiect. Trebuie apelat super.clone() pentru a face "treaba"*/
public Object clone() throws CloneNotSupportedExecution {
return super.clone();
}
int x;
transient int y; // va fi clonat dar nu serializat

public static void main(String[] args){
Clone1 = new Clone1();
c.x = 100;
c.y = 200;
 try{
 Object d = c.clone();
 System.out.println("c=" + c);
 System.out.println("d=" + d);
 }catch (CloneNotSupportedException ex){
   System.out.println("eroare!!");
   System.out.println("ex");
   }
}

/**Afiseaza obiectul curent ca si string*/
public String toString() {
return "Clone1[" + x + "," + y +"]";
}
}
